package com.heatingcharge.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.google.common.collect.Lists;
import com.heatingcharge.entity.unit.HeatCompany;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description: heating_charge_server
 * User: Devin
 * Date: 2019-07-16
 * Time: 16:58
 */
@Data
public class HeatCompanyDTO extends HeatCompany {
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<HeatCompanyDTO> children = Lists.newArrayList();

    public static HeatCompanyDTO adapt(HeatCompany heatCompany){
        HeatCompanyDTO dto=new HeatCompanyDTO();
        BeanUtils.copyProperties(heatCompany,dto);
        return dto;
    }
}
